package main

import (
	"dhfshop/service/img/signer"
	"log"
	"os"
)

var (
	//imgPath string = ""
	//fontPath string = ""
)

func init() {
	imgPath = "./img/"
	fontPath = "./font/"
}

func main() {
	// 输入文件
	src, err := os.Open(imgPath + "src.jpg")
	if err != nil {
		log.Fatalln(err)
	}
	defer src.Close()

	dst, err := os.OpenFile(imgPath+"out.png", os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0666)
	if err != nil {
		log.Fatalln(err)
	}
	defer dst.Close()

	signWriter := signer.NewSigner(fontPath + "FZFSK.TTF")
	signWriter.SetStartPoint(5, 10)
	signWriter.SetSignPoint(100, 100)
	signWriter.SetFontSize(28)
	err = signWriter.Sign(src, dst, "测试例子", 1)
	if err != nil {
		log.Fatalln(err)
	}
}
